package com.wsm.common.task;

import com.wsm.common.annotation.JobTask;
import com.wsm.oa.domain.Response;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.messaging.simp.SimpMessagingTemplate;
import org.springframework.stereotype.Component;

@JobTask("WelcomeJob")
@Component
public class WelcomeJob implements Job {
    @Autowired
    SimpMessagingTemplate template;

    @Override
    public void execute(JobExecutionContext arg0) throws JobExecutionException {
        template.convertAndSend("/topic/getResponse", new Response("欢迎体验springboot,这是一个任务计划，使用了websocket和quzrtz技术，可以在计划列表中取消，<a href=\"http:\\\\www.wangshimin.top\" target=\"view_window\">欢迎您进入springboot个人博客查看详情!</a>"));
    }

}